/* Copyright (C) 2009, 2011 Christofer Jonsson
 *
 * This file is part of FXH.
 *
 * FXH is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * FXH is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 * License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with FXH.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "fxh_crypto.h"

static const unsigned char key = 17;

void fxh_crypto_encrypt(void *data, size_t length)
{
   size_t i = 0;
   unsigned char *d = (unsigned char*)data;

   while (i != length)
   {
      d[i++] ^= key;
   }
}

void fxh_crypto_decrypt(void *data, size_t length)
{
   size_t i = 0;
   unsigned char *d = (unsigned char*)data;

   while (i != length)
   {
      d[i++] ^= key;
   }
}
